package com.xxx.filter;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * 自定义form表单过滤器
 */
public class MyFormAuthenticationFilter extends FormAuthenticationFilter {

    @Override
    protected boolean onAccessDenied(ServletRequest request, ServletResponse response, Object mappedValue)
    		throws Exception {
    	String failureKeyAttribute = super.getFailureKeyAttribute();
        if(request.getAttribute(failureKeyAttribute) != null) {
            return true;
        }
        
        return super.onAccessDenied(request, response, mappedValue);
    }
}
